Skip to content

[CDAP-21269] Add support for Dataproc Flexible Machine Types in compute profiles - #16204

Merged
123-komal merged 1 commit into
developfrom
flexvm-support
Sep 1, 2026
Merged

[CDAP-21269] Add support for Dataproc Flexible Machine Types in compute profiles#16204
123-komal merged 1 commit into
developfrom
flexvm-support

Conversation

@123-komal

@123-komal 123-komal commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Adds support for configuring flexible fallback machine types for Dataproc master and worker nodes. This allows clusters to automatically fall back to alternative machine types in priority order if the primary machine type is unavailable.

Changes

  • gcp-dataproc.json: Added masterFlexVmMachineTypes and workerFlexVmMachineTypes dropdowns to configure fallback machine types (n1, n2, n2d, e2).
  • DataprocConf.java: Added parsing and helper methods to format fallback machine types with configured CPU and memory values.
  • DataprocClient.java: Attached flexible machine type configuration to master, primary worker, and secondary worker node configs when present.
  • DataprocProvisioner.java: Added validation to verify machine type naming formats.
  • DataprocProvisionerTest.java: Added unit tests covering property parsing, validation, and cluster creation.

Testing

  • Unit tests pass locally.
  • Verified successful cluster creation and fallback configuration on a live test cluster.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for Dataproc Instance Flexibility Policies by adding configuration options for master and worker flex VM machine types. However, the current implementation is prone to throwing a NullPointerException at runtime because Protobuf builders do not accept null values when these optional properties are omitted. Feedback has been provided to conditionally build and safely apply these flexibility policies, as well as to support comma-separated machine types.

@123-komal 123-komal changed the title Adding Support for the Flexvm Add support for Dataproc Flexible Machine Types in compute profiles Aug 20, 2026
@123-komal
123-komal force-pushed the flexvm-support branch 2 times, most recently from da0c03c to c22ed75 Compare August 20, 2026 13:24
@123-komal 123-komal added the build Triggers github actions build label Aug 20, 2026
@123-komal
123-komal force-pushed the flexvm-support branch 3 times, most recently from 035da77 to 03ed2d9 Compare August 21, 2026 03:54
return Strings.isNullOrEmpty(val)
? Collections.emptyList()
: Collections.unmodifiableList(
Splitter.on(',').trimResults().omitEmptyStrings().splitToList(val));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Splitter.splitToList returns immutable list. No need to wrap it again.

private static final Splitter COMMA_SPLITTER = 
        Splitter.on(',').trimResults().omitEmptyStrings();

private static List<String> getStringList(Map<String, String> properties, String key) {
    String val = getString(properties, key);
    return Strings.isNullOrEmpty(val) 
            ? List.of() 
            : COMMA_SPLITTER.splitToList(val);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using the same method you provide, but the List.of() is not supported with the given java version. I think it was introduced in the later ones so I used the below one

private static final Splitter COMMA_SPLITTER = 
        Splitter.on(',').trimResults().omitEmptyStrings();

private static List<String> getStringList(Map<String, String> properties, String key) {  
    String val = getString(properties, key);
    return Strings.isNullOrEmpty(val)
      ? Collections.emptyList()
      : COMMA_SPLITTER.splitToList(val);
  }

"n1",
"n2",
"n2d",
"e2"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should n4 be present in the list?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have kept the supported option same as the one with we listed in masterMachineType. But we can still n4 during runtime, which I also tested and it worked.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sahusanket - Should N4 be added to the list?

Comment thread cdap-runtime-ext-dataproc/src/main/resources/gcp-dataproc.json Outdated
* Parses a comma-separated string property into a trimmed list of strings,
* or returns an empty list if null/empty.
*/
private static List<String> getStringList(Map<String, String> properties, String key) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check other fields that are "widget-type": "csv"
Example : networkTags ,scopes etc..

How are they parsed ?

And if this function can be made generic to be used for other such fields?

@123-komal 123-komal Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the other "widget-type": "csv" fields (networkTags, scopes, and initActions), updated the logic to use the generalized getString method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the logic for initActions change as it is, as it doesn't seems to backward compatible.

@123-komal 123-komal Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted the initActions to the original change.

Comment thread cdap-runtime-ext-dataproc/src/main/resources/gcp-dataproc.json Outdated
Comment thread cdap-runtime-ext-dataproc/src/main/resources/gcp-dataproc.json Outdated
@123-komal
123-komal force-pushed the flexvm-support branch 2 times, most recently from c0d5a8b to 6e30e50 Compare August 31, 2026 08:32
 Add support for Dataproc Flexible Machine Types in compute profiles

 Adding Support for the Flexvm

 Updated

 Updated

 Updated

 Updated

 Updated

 Updated

 Updated

 Updated

 Updated

 Updated

 Updated
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
61.2% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@123-komal 123-komal changed the title Add support for Dataproc Flexible Machine Types in compute profiles [CDAP-21269] Add support for Dataproc Flexible Machine Types in compute profiles Sep 1, 2026
@123-komal
123-komal merged commit f599e24 into develop Sep 1, 2026
18 of 19 checks passed
@123-komal
123-komal deleted the flexvm-support branch September 1, 2026 05:48
@123-komal
123-komal restored the flexvm-support branch September 1, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Triggers github actions build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants